package com.knowledge.controller;

import com.knowledge.common.aop.TokenValidate;
import com.knowledge.service.ArticleFavoriteService;
import com.knowledge.vo.Result;
import com.knowledge.vo.params.FavoriteParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/favorite")
public class ArticleFavoriteController {

    @Resource
    private ArticleFavoriteService articleFavoriteService;

    @TokenValidate
    @PostMapping("/save")
    public Result favorite(@RequestBody FavoriteParam favoriteParam) {
        return articleFavoriteService.favorite(favoriteParam);
    }
}
